
import matplotlib.pyplot as plt
import sys
import math, random
from PyQt5 import QtCore, QtWidgets
import os
import time

class Test(QtCore.QObject):
    overSignal = QtCore.pyqtSignal()
    testSignal = QtCore.pyqtSignal()
    def __init__(self):
        super(Test, self).__init__()
        self.msg = "over"
    def f(self):
        a = 2
        b = [1, 2, 3]
        self.overSignal.emit()

    def pt(self):
        print(self.msg)

def output(obj):
    print(obj.msg)

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    tmpObj = Test()
    tmpThread = QtCore.QThread()
    tmpObj.moveToThread(tmpThread)
    tmpThread.started.connect(lambda: tmpObj.f())
    tmpObj.overSignal.connect(lambda: tmpObj.testSignal.emit())
    tmpObj.testSignal.connect(lambda: tmpObj.pt())
    tmpThread.start()
    sys.exit(app.exec())
